import { request } from "@/utils";

export const roleApi = {
  getList: () => request.get<Role[]>("/role/list"),
  add: (data: Role) => request.post("/role", data),
  update: (data: Role) => request.put("/role", data),
  remove: (id: string) => request.delete("/role", { id }),
  getPermsById: (id: string) => request.get<string[]>("/role/perms", { id }),
  assignPerms: (roleId: string, permsIds: string[]) =>
    request.post("/role/assign-perms", { roleId, permsIds }),
};
